package com.wolong.share.creation.singleton;

/**
 * 懒汉式：首次需要时才创建
 *
 * @author wolong
 */
public class LazySingleton {
    private static LazySingleton singleton;

    private LazySingleton() {
    }

    /**
     * 同步方法效率低下
     *
     * @return
     */
    public static synchronized LazySingleton getInstance() {
        if (singleton == null) {
            return singleton = new LazySingleton();
        }
        return singleton;
    }
}
